package com.squirrel.exception;

import java.util.Arrays;

public class SquirrelException extends RuntimeException {

    private int errCode;
    private Object[] i18nParams;

    public SquirrelException() {
        errCode = 1;
    }

    public SquirrelException(int errCode) {
        errCode = errCode;
    }

    public SquirrelException(int errCode, Object[] i18nParams) {
        errCode = errCode;
        i18nParams = i18nParams;
    }

    public SquirrelException(int errCode, String message) {
        super(message);
        errCode = errCode;
    }

    public SquirrelException(int errCode, Object[] i18nParams, String message) {
        super(message);
        errCode = errCode;
        i18nParams = i18nParams;
    }

    public SquirrelException(int errCode, Throwable cause) {
        super(cause);
        errCode = errCode;
    }

    public SquirrelException(int errCode, Object[] i18nParams, Throwable cause) {
        super(cause);
        errCode = errCode;
        i18nParams = i18nParams;
    }

    public SquirrelException(int errCode, String message, Throwable cause) {
        super(message, cause);
        errCode = errCode;
    }

    public SquirrelException(int errCode, Object[] i18nParams, String message, Throwable cause) {
        super(message, cause);
        errCode = errCode;
        i18nParams = i18nParams;
    }

    public SquirrelException(String message) {
        super(message);
        errCode = 1;
    }

    public SquirrelException(int errCode, String message, Throwable cause, boolean enableSuppression, boolean writeableStrackTrace) {
        super(message, cause, enableSuppression, writeableStrackTrace);
        errCode = errCode;
    }

    public SquirrelException(int errCode, Object[] i18nParams, String message, Throwable cause, boolean enableSuppression, boolean writeableStrackTrace) {
        super(message, cause, enableSuppression, writeableStrackTrace);
        errCode = errCode;
        i18nParams = i18nParams;
    }

    public int getErrCode() {
        return this.errCode;
    }

    public Object[] getI18nParams() {
        return this.i18nParams == null ? null : Arrays.copyOf(this.i18nParams, this.i18nParams.length);
    }

    @Override
    public String toString() {
        StringBuffer stringBuffer = new StringBuffer("TonyStarkException{");
        stringBuffer.append("errCode=").append(this.errCode);
        stringBuffer.append(",i18nParams=").append(this.i18nParams);
        stringBuffer.append("}");
        return stringBuffer.toString();
    }
}
